package qdu.edu.com.fushanf4.service.count.usertype.search2characters.count;

import org.apache.hadoop.mapreduce.Job;
import qdu.edu.com.fushanf4.service.count.TextIntWritableCountReducer;
import qdu.edu.com.fushanf4.utils.ConfigurationUtil;
import qdu.edu.com.fushanf4.utils.DriverUtil;

import java.io.IOException;

public class SearchTwoCharactersCountDriver extends DriverUtil {
    public static void main(String[] args) throws IOException {
        SearchTwoCharactersCountDriver searchTwoCharactersCountDriver = new SearchTwoCharactersCountDriver();
        searchTwoCharactersCountDriver.run(args);
    }
    @Override
    public Job runJob(String[] path) throws IOException {
        Job job = ConfigurationUtil.getJob();
        assert path.length == 3;
        job.getConfiguration().set("twoCharactersPath", path[2]);

        job.setJarByClass(SearchTwoCharactersCountDriver.class);
        job.setMapperClass(SearchTwoCharactersCountMapper.class);
        TextIntWritableCountReducer.setReduceOfAll(job);

        ConfigurationUtil.setPathAndRunJob(new String[]{path[0], path[1]},job);
        return job;
    }
}
